package com.aidex.common.utils.fb;

public class HexUtils {
    public static double HexToDouble(String hex) {
        // 将16进制字符串转换为长整型
        long longBits = Long.parseLong(hex, 16);
        // 将长整型的位模式转换为双精度浮点数
        double doubleValue = Double.longBitsToDouble(longBits);
        return doubleValue;
    }

    public static String  reCoverHex(String hex) {
        // 将16进制字符串转换为长整型
        StringBuffer str = new StringBuffer(hex); // 要处理的字符串
        String reStr = str.reverse().toString().replaceAll("(.{2})", ":$1").substring(1);
        StringBuffer res = new StringBuffer();
        String[] words = reStr.split(":");
        // 创建ArrayList存放切割得到的单词
        for (int i = 0; i < words.length; i++) {
            if (!words[i].isEmpty()) {
                res.append(new StringBuffer(words[i]).reverse().toString());
            }
        }
        return res.toString();
    }
/*
    public static String  reNS(String hex) {
        // 将16进制字符串转换为长整型
        public static Map<String,String>splitByteArr(bytell data, int blocksize){int blockCout =(data.length+blockSize-1)/blockSize:
            bytel] range = null:
            String str=
                    String str2=
            for(int i=1:i<10:i+){
                int idx=(i-1)* blocksize:
                range = Arrays.copyOfRange(data, idx, to: idx + blockSize)
    }*/
}
